﻿//书籍管理系统
void MangaeBook()
{
	int item;
	ShowBookMenu();
	cin >> item;
	while (item)
	{
		switch (item)
		{
		case 1:
			ShowBook();//显示图书信息
			break;
		case 2:
			AddBook();//添加图书信息
			break;
		case 3:
			SearchBook();//查找图书信息
			break;
		case 4:
			DeleteBook();//删除图书信息
			break;
		case 5:
			ModifyBook();//修改图书信息
			break;
		default:
			cout << "\t\t" << "输入错误，请重新输入" << endl;
			Sleep(1500);
			break;
		}
		cout << endl << "按任意键返回" << endl;
		_getch();//从控件中获取字符而无需显示
		ShowBookMenu();
		cin >> item;
	}
}


int ReadReaderFile(const char* fopenMode)
{
	int ReaderRecord = 0;
	FILE* pfReader;
	pfReader = fopen("reader.txt", fopenMode);
	if (pfReader == NULL)
	{
		return -1;
	}
	while (!feof(pfReader))//feof读文件的末尾
	{
		if (fread(&astReader[ReaderRecord], LEN_READER, 1, pfReader))
		{
			ReaderRecord++;
		}
	}
	fclose(pfReader);
	return ReaderRecord;
}
